import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import postCssPxToRem from "postcss-pxtorem"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: [
      { find: '@assets', replacement: resolve(__dirname, 'src/assets') },
      { find: '@runtime', replacement: resolve(__dirname, 'src/runtime') },
      { find: '@components', replacement: resolve(__dirname, 'src/components') },
    ]
  },
  build: {
    // outDir: 'C:/Program Files (x86)/苏州衡鸿信息科技有限公司/虚拟仿真实训教学中心/PlatformRelease/Externals/比亚迪秦EV整车故障诊断仿真教学软件/UI',
    // outDir: 'D:/平台UI/Platform/Externals/比亚迪秦EV整车故障诊断仿真教学软件/UI',
    // outDir: 'D:/打包文件',
    // outDir: 'D:/运行环境/P10042-旧/UI',
    outDir: 'D:/运行环境/P10042/UI',
    emptyOutDir: true,
    assetsDir: 'assets',
    // minify:false,
  },
  server: {
    cors: true,
    host: "127.0.0.1",
    open: true
  },
  css: {
    postcss: {
      plugins: [
        postCssPxToRem({
          rootValue: 192, // 1rem的大小
          propList: ['*'], // 需要转换的属性，这里选择全部都进行转换
        })
      ]
    }
  },
})
